<script setup>
import { ref, watch } from "vue";
const count = ref(0);
function increment() {
  console.log(count.value);
  count.value++;
}
watch(count, (newValue, oldValue) => {
  console.log(`Count changed from ${oldValue} to ${newValue}`);
});
</script>
<template>
  <div>
    <p>当前计数:{{ count }}</p>
    <button @click="increment">增加</button>
  </div>
</template>
